//
//  JudgeScoreTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/19.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "JudgeScoreTableViewCell.h"

@implementation JudgeScoreTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    //目标 方式 任务
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.detailLabel];
    [self.contentView addSubview:self.scoreView];
    [self.contentView addSubview:self.stateLabel];
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 60, WIDTH, 30)];
        _titleLabel.font = font(24);
        _titleLabel.textColor = SFM51;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.text = @"报修已完成";
    }
    return _titleLabel;
}

-(UILabel *)detailLabel
{
    if (_detailLabel == nil) {
        _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 95, WIDTH, 20)];
        _detailLabel.font = font(14);
        _detailLabel.textColor = SFM153;
        _detailLabel.textAlignment = NSTextAlignmentCenter;
        _detailLabel.text = @"您的评价会让我们更好";
    }
    return _detailLabel;
}

-(LHRatingView *)scoreView
{
    if (_scoreView == nil) {
        _scoreView = [[LHRatingView alloc]initWithFrame:CGRectMake(WIDTH/2-130, 130, 260, 50)];
        _scoreView.score = 3;
        _scoreView.ratingType = INTEGER_TYPE;
        _scoreView.delegate = self;
    }
    return _scoreView;
}

-(UILabel *)stateLabel
{
    if (_stateLabel == nil) {
        _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.scoreView.frame) + 17, WIDTH , 20)];
        _stateLabel.font = font(14);
        _stateLabel.textColor = SFMColor(245.99, 109.99, 35.99);
        _stateLabel.textAlignment = NSTextAlignmentCenter;
        _stateLabel.text = @"基本满意";
    }
    return _stateLabel;
}

- (void)ratingView:(LHRatingView *)view score:(CGFloat)score
{
    if (score == 5) {
        self.stateLabel.text = @"非常满意";
    }else if (score == 4)
    {
        self.stateLabel.text = @"满意";
    }else if (score == 3)
    {
        self.stateLabel.text = @"基本满意";
    }else if (score == 2)
    {
        self.stateLabel.text = @"接受";
    }else if (score == 1)
    {
        self.stateLabel.text = @"不接受也不再投诉";
    }else
    {
        self.stateLabel.text = @"拒绝接受继续投诉";
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
